#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc,char *argv[])
{
    unsigned short data[3]={0,0,0};
    
    int fd=open("/dev/ap3216c",O_RDONLY);
    if(fd<0)
        return -1;
    while(1)
    {
        if(read(fd,data,6)==0)
            return -1;
        printf("get data: ir %d,als %d,ps %d\n",data[0],data[1],data[2]);
        usleep(200000);
    }
    close(fd);
}